package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DzHuiyi;
import com.ruoyi.system.service.IDzHuiyiService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 会议管理Controller
 * 
 * @author ruoyi
 * @date 2023-11-12
 */
@RestController
@RequestMapping("/system/huiyi")
public class DzHuiyiController extends BaseController
{
    @Autowired
    private IDzHuiyiService dzHuiyiService;

    /**
     * 查询会议管理列表
     */
    @GetMapping("/list")
    public TableDataInfo list(DzHuiyi dzHuiyi)
    {
        startPage();
        List<DzHuiyi> list = dzHuiyiService.selectDzHuiyiList(dzHuiyi);
        return getDataTable(list);
    }

    /**
     * 导出会议管理列表
     */
    @Log(title = "会议管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DzHuiyi dzHuiyi)
    {
        List<DzHuiyi> list = dzHuiyiService.selectDzHuiyiList(dzHuiyi);
        ExcelUtil<DzHuiyi> util = new ExcelUtil<DzHuiyi>(DzHuiyi.class);
        util.exportExcel(response, list, "会议管理数据");
    }

    /**
     * 获取会议管理详细信息
     */
    @GetMapping(value = "/{hyId}")
    public AjaxResult getInfo(@PathVariable("hyId") Long hyId)
    {
        return AjaxResult.success(dzHuiyiService.selectDzHuiyiByHyId(hyId));
    }

    /**
     * 新增会议管理
     */
    @Log(title = "会议管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DzHuiyi dzHuiyi)
    {
        return toAjax(dzHuiyiService.insertDzHuiyi(dzHuiyi));
    }

    /**
     * 修改会议管理
     */
    @Log(title = "会议管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DzHuiyi dzHuiyi)
    {
        return toAjax(dzHuiyiService.updateDzHuiyi(dzHuiyi));
    }

    /**
     * 删除会议管理
     */
    @Log(title = "会议管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{hyIds}")
    public AjaxResult remove(@PathVariable Long[] hyIds)
    {
        return toAjax(dzHuiyiService.deleteDzHuiyiByHyIds(hyIds));
    }
}
